small fixups to code
have curtain effect, but bug remains with bad image data