Fix some bugs that were introduced