add check for Null pointer