Fixed unintended modification of input image