fixed bug in washr template with three levels of nested state
Added tests for template.State