Final debugging fixes