fixed segment fault