Minor bugfixes

Signed-off-by: Luke Oatham <lukeoatham@gmail.com>