Fixes the error detection method which looked for wrong type in the code.