Fixed getId query