Fixed strange bug caused by use of Canvas graphics context.