Fixed bug in search query

- Also fixed NPE in EditAccount