small bug fixes to get it to work