Bug fix to fall back qp encode function