Fix: changed query to get valid positions