Make sure the shift variable is calculated correkt.