fixed segfault on work error