The effects of calibration errors and foreground filters on the CHIME power spectrum measurement : a study with simulations and real data