pull request for bug 1102111 and bug 1090047

It got r+ from @jonallengriffin  on bug 1102111 and bug 1090047. Please kindly help on merging it.