enhance Encoder API + fixes