Fix encoder problems