method_exists instead of !is_null
fix