Fix saving advanced search

Fixes #379