Check study access rights and study exists

 Fix #445
Not sure that's the case at this point, is it? Basically you are sending
them to the template in the next line.