Fix strict errors plus a couple of bugs