Fixed some problems found out by real deployment