Fix #266, memory and DOM leaks

## before
![beaker 266-before](https://cloud.githubusercontent.com/assets/1767921/3693073/2b71f8c2-1363-11e4-9e58-99454bdd5e0f.png)
## after
![beaker 266-after](https://cloud.githubusercontent.com/assets/1767921/3693075/2df2804e-1363-11e4-85fe-f42ea7d08e04.png)