accumarray fix and minor bugs