fixed duplucate encoding