fix infinite loop when replacing '&' by "&amp;"