Bug while resizing canvas fixed