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