some debugging fixes