try catch for resize