Fixes NullPointerExceptions