fixed minor bug on line 496