Refs #414. Fixed some code construction issues.