Fix 4 attributeerror index

fixes issue #4