Added test and fixed further