Fixed problem that created nullpointerexception