fixed some issues with timing