Minor bug fixes for IIS and some cleanup