Incorrect dictionary assignment done previously. Rectified it by using copy()