Fix error loading source in resize function