bugfix in retrace code