small bug fixes (thanks Ruby)