bugfix and improve