fixed misc errors and warnings