Fixed Null pointer exception