fix bugs related to improper db query and faye workers not dying