Fixed JavaScript error when database has no table