Added lock checking