fix code bugs