fixed crashing between tabs and better drawing results