added cleaner locking on handle_mail call