Tests, fixes