fixes and debugging