Fix some small bugs