fixed several scratchpad bugs and make changing ws smooth