fix for bug 133, copied from PreloadJS