Fixed indexing bug in source initialization