porting from java
resolve conflict