various debug and fixes