only add prefixes to query if they are not there, closes #217