Fixed isactive querying