fixed recrusion return statement