fixes undefined object issue