some hand tuning to make it compile