Fixed issue #39 for atom.py. Also some fixes in canvas.