database and javascript fixes