Fixed some bugs in bin code fragment.