some bug fixes.