fixed some lingering bugs and updated query package so metric tool also works with new schema