Fixes serveral bugs. It should now work with all types of Pages (Normal, Application and Publishing Pages).
NB: Please notice that when using a master on an Application Page you will problably miss some Placeholders. In particular you should make sure these are present:
<asp:ContentPlaceHolder id="PlaceHolderPageDescriptionRowAttr2" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageDescriptionRowAttr" runat="server"/>
Also: The Search Box can give problems on some Application Pages so you are problably better of creation a specific MyApplicaiton.master is compatible with Applicaiton pages.
I have included a default Sharepoint Web.config (MOSS 2007) with the changes included.