Fixing Several Issues
FIxed Database Functions