new version of improveFunction
add double-type in images