Corrected minor bug in codes