Fix database procedures
Fix sef counter