bugfix: padding should occur in all three dimensions (+performance improvement)