fix a None type bug