Fix issues identified by Stack static checker.