resolved seg fault error