Fixed bug which thre exception when invalid type was specified.