fix bugs to make it compile