GT-1081: fixed. Add tests.