Fix handling of loads and stores in IR