$classname must be outside the check