Fixes some bugs in equipment generation and db querying