Fixed bugs in logspace