small clean-up, Safari fix (check next/prev are defined)