rtrim doesn't work

Fix by Skizzerz

Change-Id: I87340a0b76e49fd5409cfc965d13c4a19a4b156d