fixed some initialization bugs #2