bug fixes. Everything before mongo works