Fixed bug 564. The problem is that 'varnum' was being cast from unsigned long to int without warning. Some debug output added, needs to be removed.