fixed nullpointer, still bugged though