Issue refs #1768: fixed some bugs after testing