Fix a bug with an undefined index

Signed-off-by: Dries Vints <dries.vints@gmail.com>