CLOUD-306 fixed nullpointer check