The existing implementation was completely broken. Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 415dfa89e2)
415dfa89e2