Fixed bug 'CGContextTranslateCTM: invalid context 0x0'

This fixes #19

Credits: mdb983