Add class_exists to method_exists

Fix the "internal sever error message" on some php installation