trying to fix a nilclass error im having