Fix some bugs, add others