fixed some bugs in normalization