updated path checking in save method