fix the bug. closes #645