Add array_fill to read-only methods to fix segmentation fault

Fix the problem mentioned in #618.