some bug fixes here and there