Fixes for timing issues and a merge from a pull request