Fix bugs in wrapper for level4