logic problem with module definiton