Minor bugfixes

Signed-off-by: Martin Evans <martindevans@gmail.com>