various bugs are fixed