fix some decode logig