improve code style
add dirty logging when an error occured
debugs and merge conflict