Fix string cast exception