A few important fixes