Fix and tests