fixed bug in resize handler