corrected bug : bad use of map