Fix some warnings and an error in calling the delegate