implemented bug fixes