possible bug if db query fails, who knows, but it's safer to do this