log functions added. some bug fixes