bug fixing and preparation for run on JUDGE