Finally Database functions comprobated and fixed