Update repaint.js

Fixed few bugs.