fixed require directory problems and changing methods for database connecting