workaround for a bug and other fixes