ahead is not calculated properly