added a test for trac bug 596 and also a test and fix for unit ideal input