quadratic bug fixes and equation handling