Fixed side effect bug