Fix exception in save tio file function