better fix for flipImage