Various fixes from the previous year

Battled tested on one of our client's apps.