Port new features from upstream slock