More fixes and debugging