Better handling of multiple locks