Fixes NullPointerExceptions.