fixed computation bugs