Errors and warnings fixed