Fixed error class files and wrote unit-tests