modified zimcheck.cpp