Padding function repaired. A previous commit closed #1. This one closes #2.