Bug 1002593 - Get Gallery changes for bug 989290 and 1003036 into master