fixing database and adding apps table