Fixed various tiny bugs