fix a bunch of little bugs; uninitialized variables and pins