Fixing issues in image writer