Fixed nullpointer exception, still a hanging error