fixed a bug in padding