Fix range header bugs in controller