fixed up encoder stuff