Small fixes to state code

Mainly for compiling on pre-NET 4.5