Fixed incorrect check for method defined