Fixed some minor bugs in data processing