added additional image writes for debugging