fix corner case bug