added npe check