fix bugs in reverse words