Tried fix for nullpointerexception