bug fixes. watch commit for details