Fixed duplicate encoded ampersands, closes #837