Quick fix: missing global and an undefined index

Signed-off-by: emanuele <emanuele45@gmail.com>
Merge pull request #307 from emanuele45/master

Quick fix