Changed fix for windows bug so as to not break core when script is a resource and not a file