Fixing Null pointer