another bug falls!
clamp result at boundaries
another bug