bug fixes to equations