few fixes here and there, check the diff