more bug fixes, just need to fix main i think