Fix #1160, and clear the canvas correctly.

@mramato can you test in IE11?