Added check for null object