fixes code-analysis, rewrite ImageScale patch