re-added code broken by rustc, seems to be working correctly now