updated sql and fixed activity dao