cahnged logging, fixed some last bugs