Fixed bug with type being null