Array bug fixing