Fixed bugs when Nx=0 (no state)