fixed reading id of undefined