basic implementation of resize()