compile with -O3
some more fixes... still a memory leak somewhere