Fix race condition in icon drawing

Closes #8