Fix most stuff. Still need to fix lib detectiona and compilation on osx/windows