misc core bugfixes, add trace support to core_sim