Fix some gq bugs when tw was set

Fix some bugs that only occured when tw was set.