Some fixes for mapreduce