Merged r13115 and r13171 from trunk to 2.5-stable (#16194)

git-svn-id: http://svn.redmine.org/redmine@13204 e93f8b46-1217-0410-a6f0-8f06a7374b81