diff --git a/templates/machine.m.motemplate b/templates/machine.m.motemplate
index 70129f2c..41c9eaca 100644
--- a/templates/machine.m.motemplate
+++ b/templates/machine.m.motemplate
@@ -26,6 +26,7 @@
 	return (<$managedObjectClassName$>ID*)[super objectID];
 }
 
+<$if noninheritedAttributes.@count > 0$>
 + (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key {
 	NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
 	<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasDefinedAttributeType$><$if Attribute.hasScalarAttributeType && (Attribute.optional || !TemplateVar.scalarsWhenNonOptional)$>
@@ -37,6 +38,7 @@
 
 	return keyPaths;
 }
+<$endif$>
 
 <$foreach Attribute noninheritedAttributes do$>
 <$if Attribute.hasDefinedAttributeType$>