fixing selector and encoding