fixed some problems and compiling