fixed solution for P27