Fixed more detection bugs