Fixed other undefined errors due to missing checks

Signed-off-by: emanuele <emanuele45@gmail.com>