Fixed bug in sweep
Modified apply_scidb to retain dimension of original array