Latest fixes as we start implementing mongodb