Fixed problem with encoder