[BUG] Fixed thread-safety problem when accesing relations