Added tests by nlaz and jrh4289