Fixed state synchronization issue with Encoder.cpp