fix stack rewind after function return