Fix some NullPointerExceptions