Fixed the bug for storing image locally.