Fixed abstract lock and sql script