Fixed waitUntil logic
Fixed NPEs and divide by zero errors when calculating action wait time