Fix some strange bugs