Trying to solve a weird problem