Fixed error for running query.