Final patch of mediahadler

Fixed #288 & #289. commits. This has been tested and works
Merge pull request #290 from kaanklky/patch-1

Final patch of mediahadler