adding some ugly code (but it works)