edited to prevent crashing