corrected seg fault