Fix for null pointerexception