improved payload decode (length detection)