Issue#596 stop iterating back up the hierarchy if the class doesn't exist