map structure change and bug fix