fixed small bug in computation of reference point