Bug fixes

Signed-off-by: Carlo Caione <carlo.caione@gmail.com>