fixed core script bugs