various debugging fixes