implemented and fixed sub operation, added tests (ref #191)