index -1 error, works now