Correct array indexing error
Added more protoypes
Added missing source file to patch