if no species_ids then 0
App is working properly again. Stupid postgresql did like ordering a blank string.