some fixes for compling with shanchen but not ready yet