fixed some Null Pointer mishaps