localize added better exception handling