fix javascript errors caused by an empty database