fixed small bug that caused seg fault