A pair of note spacing collisions

I post a pair of situations where note spacing is not working as good as always.The first involves the distance between the last note of a grace note group and the main note when they have lyrics (it also happens when only one grace note). The second is a collision of beams with stem slashes:
I hope it helps to improve the algorithm.