fixed small bug found by Matteo