Null pointer Exception fix