fix initialization bugs