Fixed bugs related to BAMPE.