runtime error fixed. debugging for correctness.