Added tests to find the detect problem. Updated fix to use better syntax.