Fix undefined index errors in computation functions

Change-Id: Ieaabe8744c35a13a0525a680e51ea88e097aab86