Fixing minor bugs and improving workaround code.