Fix for failing query