some really late night but small bug fixes