correcting resize with conditional