fix bug 1321

see comments in mantis