Fixed small bug - querying for studies by samples only if studies not given