small bug in unused function