Fixing padding bug (allowing zero as a valid padding value)