Made literal handling more robust