Null pointer Error fix