minor fixes
optimize protocol decoder