fixed also added some tests for that