refs #4903 added tests and fixed some issues