Fixed bug in padding