Fix bucket-operation bugs and format codes