fixed few uncommon bugs