fix segimentation fault