Output to DB + small fix for selected rules