fixed so that it can report error when convert to int.