updated to fix crash