Fixed some regression bugs