changed some functions in database