Fixed bugs in several operations.