fixed return
made more robust