added null option to device query