made 'fromfile' more robust