Fixed some more bugs caused by rebase