Commtrack fix for bad API queries

two part fix (see commits) - don't query when no id, and don't 500 when a bad id