fix the bug in buliding location dictionary