making a IORef op slightly stricter for no reason
add an awful hack to fix wrong behavior