Query background layers even when there's no queriable layer displayed

Should fix #719.
Please review.