Added database auth copy, fixed some bugs