updated to fix bug