Add test_determine_class and fix of else/if bug