first and last padding fix