minor improvements to decoder