Fixes to png handling