A few fixes

A bunch of fixes from my repository, including one rather critical task calculation bug.