Various fixes / attempts to fix the encoder issue

Various fixes and attempts to try and fix the encoder issue