Fix multiple NullPointerExceptions
Merge branch 'master' into nullpointer