fixed various bugs, no API changes was made