DB functions fix