Fix bug with mapping tool and library bugfixes