Fixed detection bug.
Dip into unsafe to avoid any memory allocaions.