Fixed issues with image handling.