tests and small bug fix