Fixed some bugs, including crashes with NSNotificationCenter and NSRegularExpression.