fix getting stuck at end of class