add exceptions to changeObjectToClass function