fix bug with reverse()