adding file_exists check for image path