some fix and tests