map function works but lot of bug..