Issues are solved. In WPML settings (WPML->Translation management->Multilingual Content Setup) there was one setting which was preventing media to work properly. I changed it to “Do nothing” with media and now media works.
And duplicate issue was caused because of some codes in functions.php. By modifying them I made it to work.