Fixed a bug with localize function