Reduce number of evaluated queries.

* Properly close with tag.
* Properly check for band existance