minor fix and improve performance