Adds a bit of better logging, fixes a minor bug