fixed segfault, asst other things