fixed error messages due to invalid graphics context (fixes phatblat/#1)

fixed error messages due to invalid graphics context (fixes #1)