Fixed some namespace problems, and a few changes on database adapters