copied from current xbmc version (gotham)