Fix bugs due to dynamic wrapping