fixed issues in device detection