returning data from server. still not updated correctly in frontend