a bug fix and small enhancemnt