Fixed some bugs with indexing with NA's