bugfix and optimize ibs
fix some problems caused by whitespacing