Some bugs around pinning fixed.