Debugging, a few fixes