Fix JSON being sent before HTML in routes