device filtering and some fixes