Fix case where saving query always used current context/view

Fix #395.