A lot of fixes, tests fixed (travis still failing though)