fixed crashes, hopefully