correct prototypes signed/unsigned mismatch
correct max buffer len processing