Fix undefined index error

This resolves issue #255.