This patch was backported from upstream master branch. Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>