The fuse operation and the script itself will work correct if to change the negative dx to the positive one (as well as the x-origine, accordingly) in the addRectangle().