Fix bug in determining blocks