use implicit cast in alloc()
avoid double memory allocation