Improve box() around edge cases