Added checking for null