fixing image handling