Fixed logdir and cleanup of localstate