FIxed indexing bug in grab command