Fixed a bug which threw an error when drawing image layers