Fixed a mis-merge. And some bugs.