fix xpath again
added some safety to the parse function