some slight improvements to cairo rendering code