Remove bug that sets img to NoneType after rectangle is created