Various fixes

Fixes to unused and uninitalized variables.