Fixed script execution order.