Added delay to fix race condition