Minor fixes and debugging