Added error check for bad Type