adding the safeapply method to handle the user