Fixed a bug with determining type.