Fix tests

Merged since it's needed and small changes.