Merge from dev 0.4.0