added mutex for db