Fixed code for new AppKit API.