added bug fixes