added fix for null pointer expection