optimized ns detection a bit more