Fix bugs found during QA test