working without error till threshold crossing