Fixed detect. Tests for same.