Added Apache v2 license to project.

Some Updates du to configuration.
Fixed some bugs related to DBs.