Fixed "Cannot call method 'forEach' of null" error