safe checking in handler