replace some die()s