Added null check on object and using preiously unused parameter time.