Check return value
Mixed imwri improvements