added asserts for <, fixed a bug