added fix for different kernel sizes