Removed duplicated id
Added missing script type
Removed useless cast check and some fixes