translate: fixed bug with inplace and optimization

tests required