bugfix and functional improvement