fix js errors caused by an empty db