fix to state order bug