fixing encoder