small bug fix to free