improved query, but still doesn't work