Added logging on restart, fixed bugs