code change to avoid segfault