Fixed code to delay action