fixing error null pointer