Replaced try catch blocks against invalid positions with require calls