Some modifications. May fix #1