fixed bug raising null pointer when getting the target class