Fix error and add log