partition function fix