This test should be done before line 147. Otherwise a null className will lead to problems line 147 and 148