rewritten ui locks logic, fix #260