fixed bug in exact calculation