Improved extension handling.