rename wstest to index, more error handling