Use substr instead of ltrim and kill the leading backslashes in Core.