Fixed two poptential NullPointerExceptions