Fix NullPointer Exceptions