That could be caused by you blocking boot with the sleep command. Are you running it in a subshell? Something like this:
That will not block anything, but will still wait with running the command.
For finding the correct timing, start with 60, reduce to 30 at next boot, and so on until you've honed in on a sleep time that works but's not too long.
Ok I'm gonna try to reduce the sleep time