made small changes so that it compiles in gcc