Fix various stuff, including tests should now run properly (bit a ugly hack but it works)