cast instances from parser to correct type