Added extra check before returning data