Fix some errors in implementation.