another fix in peak detector