Some detection improvements

To avoid false positives and such.