fixing slice error